	
	package com.inotai.jasmine.value;

	class DictionaryValue extends Value
	{
		private LinkedHashMap map;
		
		DictionaryValue() {
			super(ValueType.DICTIONARY);
			this.map = new LinkedHashMap();
		}
		
		int size() {
			return this.map.size();
		}
		
		Iterator iterator() {
			return this.map.entrySet().iterator();
		}
		
		
		/**
		  * Adds a value to the map.
		  * 
		  * @param name Name of the value
		  * @param value Value
		  */
		Value add( String name, Value value ) {
			this.map[name] = value;
			return value;
		}
		
		Value get( String name ) {
			if( this.map.containsKey(name) ) {
				return this.map[name];
			}
			return null;
		}
		
		Value remove( String name ) {
			if( this.map.containsKey(name) ) {
				return this.map.remove( name );
			}
			return null;
		}
	}